<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="com.multysite.entity.admin.Application"%>
<%@page import="java.util.TreeMap"%>
<%@page import="com.google.appengine.api.users.UserServiceFactory"%>
<%@page import="com.google.appengine.api.users.UserService"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	UserService userService = UserServiceFactory.getUserService();
	List<Application> listApp = (ArrayList<Application>) request
			.getAttribute("result");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>List Applications</title>
<style>
.error {
	color: red;
}
</style>
</head>
<body>
	<%
		if (listApp != null && listApp.size() > 0) {
			for (Application app : listApp) {
	%>
	<p>
		<%=app.getTitle()%>&nbsp;
		<a href="http://<%=app.getId() %>.<%=request.getServerName() %><%=":"+request.getServerPort() %>/admin" title="Detail">(Setting)</a>&nbsp;|&nbsp;
		<a href="http://<%=app.getId() %>.<%=request.getServerName() %><%=":"+request.getServerPort() %>" title="Detail">(Client)</a>
	</p>
	<%
		}
	%>

	<%
		} else {
	%>
	<p>Have no application.</p>
	<%
		}
	%>
	<a href="/create" title="New Application">Create Application</a>&nbsp;&nbsp;|&nbsp;
	<%=userService.getCurrentUser().getEmail() %>&nbsp;<a href="<%=userService.createLogoutURL("/")%>">(Logout)</a>
	</td>
</body>
</html>